package com.googlecode.c4e.ui.adapters;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.model.IWorkbenchAdapter;

import com.googlecode.c4e.ContinuumHelper;
import com.googlecode.c4e.model.Project;

public class ProjectAdapter implements IWorkbenchAdapter {

  public Object[] getChildren(Object obj) {
    return new Object[0];
  }

  public ImageDescriptor getImageDescriptor(Object obj) {
    try {
      Project project = (Project) obj;
      ImageDescriptor result = ContinuumHelper.imageDescriptors.get(project.getState());
      return result;
    } catch (ClassCastException cce) {
      return null;
    }
  }

  public String getLabel(Object obj) {
    try {
      Project project = (Project) obj;
      return project.getName();
    } catch (ClassCastException cce) {
      return null;
    }
  }

  public Object getParent(Object obj) {
    // TODO Auto-generated method stub
    return null;
  }

}
